function afficheMenu(obj){
	
	var idMenu     = obj.id;
	var idSousMenu = 'sous' + idMenu;
	var sousMenu   = document.getElementById(idSousMenu);
	
	/*****************************************************/
	/**	on cache tous les sous-menus pour n'afficher    **/
	/** que celui dont le menu correspondant est cliqu **/
	/** o 4 correspond au nombre de sous-menus         **/
	/*****************************************************/
	for(var i = 1; i <= 8; i++){
		if(document.getElementById('sousmenu' + i) && document.getElementById('sousmenu' + i) != sousMenu){
			document.getElementById('sousmenu' + i).style.display = "none";
		}
	}
	
	if(sousMenu){
		//alert(sousMenu.style.display);
		if(sousMenu.style.display == "block"){
			sousMenu.style.display = "none";
		}
		else{
			sousMenu.style.display = "block";
		}
	}
	
}

function toggleActiveSim(id) {
	$('#activeSIM_'+id).toggle();
}

//Play sound
function getHtmlSound( sPlayerID, sURL ) {
	var sUserAgent = navigator.userAgent.toLowerCase();

	if( sUserAgent.indexOf("msie") != -1 && sUserAgent.indexOf("opera") == -1 )
		sHTML = '<bgsound id="'+sPlayerID+'" src="'+sURL+'" loop="1" autostart="true"></bgsound>';
	else if( sUserAgent.indexOf("firefox") != -1 && sUserAgent.indexOf("windows") == -1 )
		sHTML = '<embed id="'+sPlayerID+'" name="'+sPlayerID+'" type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" src="'+sURL+'" displaysize="4" autosize="-1" bgcolor="darkblue" showcontrols="false" showtracker="-1" showdisplay="0" showstatusbar="-1" videoborder3d="-1" width="0" height="0" autostart="true" designtimesp="5311" loop="false"></embed>';
	else
		sHTML = '<embed id="'+sPlayerID+'" type="audio/x-wav" src="'+sURL+'" loop="false" autostart="true" autoPlay="true" width="1" height="1" bgcolor="white" autohref="true" volume="100"></embed>';
	
	return sHTML;
  
}

function getCookie( sNname ) {
	var i,x,y,
	ARRcookies = document.cookie.split(";");
	for( i=0; i<ARRcookies.length; i++ ) {
		x = ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
		y = ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
		x = x.replace(/^\s+|\s+$/g,"");
		if( x == sNname )
			return unescape(y);
	}
	return null;
}

function setCookie( sName, sValue, iExpire ) {
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + iExpire);
	var sValue = escape(sValue) + ((iExpire==null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie = sName+"="+sValue;
}

function getVoiceStatus() {
	return parseInt(getCookie("useVoice"));
}

function toggleVoice() {
	var bStatus = getVoiceStatus();
	setCookie( 'useVoice', bStatus? 0 : 1, 365 );
	$('#btAideVocale').attr('src', bStatus? '../images/moncompte/identification/btnAideOff.png' : '../images/moncompte/identification/btnAideOn.png').attr('alt', bStatus? "Activer l'aide vocale" : "Désactiver l'aide vocale").attr('title', bStatus? "Activer l'aide vocale" : "Désactiver l'aide vocale");
}



function playSound( sID, sURL, sType ) {
	if( !soundManager.getSoundById(sID) ) {
		soundManager.createSound( {
			id		: sID,
			type	: sType,
			url		: sURL,
			autoLoad: true,
			autoPlay: false,
			volume	: 100
		} );
	}
	soundManager.getSoundById(sID).play();
}
